<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="utf-8" />
    
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
  <title>
    CSS3_two.md |  Small Bridge
  </title>
  <meta name="generator" content="hexo-theme-yilia-plus">
  
  <link rel="shortcut icon" href="/favicon.ico" />
  
  
<link rel="stylesheet" href="/css/main.css">

  
  <script src="https://cdn.jsdelivr.net/npm/pace-js@1.0.2/pace.min.js"></script>
  
  

  

<link rel="alternate" href="/atom.xml" title="Small Bridge" type="application/atom+xml">
</head>

</html>

<body>
  <div id="app">
    <main class="content">
      <section class="outer">
  <article id="post-CSS3-two-md" class="article article-type-post" itemscope
  itemprop="blogPost" data-scroll-reveal>

  <div class="article-inner">
    
    <header class="article-header">
       
<h1 class="article-title sea-center" style="border-left:0" itemprop="name">
  CSS3_two.md
</h1>
  

    </header>
    

    
    <div class="article-meta">
      <a href="/2020/05/14/CSS3-two-md/" class="article-date">
  <time datetime="2020-05-14T13:14:57.000Z" itemprop="datePublished">2020-05-14</time>
</a>
      
  <div class="article-category">
    <a class="article-category-link" href="/categories/CSS/">CSS</a>
  </div>

      
      
<div class="word_count">
    <span class="post-time">
        <span class="post-meta-item-icon">
            <i class="ri-quill-pen-line"></i>
            <span class="post-meta-item-text"> 字数统计:</span>
            <span class="post-count">3.7k字</span>
        </span>
    </span>

    <span class="post-time">
        &nbsp; | &nbsp;
        <span class="post-meta-item-icon">
            <i class="ri-book-open-line"></i>
            <span class="post-meta-item-text"> 阅读时长≈</span>
            <span class="post-count">18分钟</span>
        </span>
    </span>
</div>

      
    </div>
    

    
    
    <div class="tocbot"></div>





    

    
    <div class="article-entry" itemprop="articleBody">
      


      

      
      <p>@<a href="CSS3">TOC</a></p>
<h1 id="自定义字体-amp-字体图标"><a href="#自定义字体-amp-字体图标" class="headerlink" title="自定义字体&amp;字体图标"></a>自定义字体&amp;字体图标</h1><a id="more"></a>
<ol>
<li><p>CSS3允许我们自定义字体</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">@font-face&#123;</span><br><span class="line">	font-family: <span class="string">"自定义的字体名字"</span>;</span><br><span class="line">	src: url(字体文件路径);</span><br><span class="line">&#125;</span><br><span class="line"><span class="comment">/*使用*/</span></span><br><span class="line">h1&#123;</span><br><span class="line">font-family: <span class="string">"自定义字体的名字"</span>;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure></li>
<li><p>自定义字体最重要的应用就是字体图标<br>字体图标大致的制作过程是：<br>a. 制作一套矢量图<br>b. 矢量图与字符一一进行绑定<br>c. 使用工具或者站点生成一套字体图标<br>d. 通过给标签添加相应的类名将字体图标引用到页面上<br>一般不需要大家自己制作字体图标，引用别人的或者找UI帮你设计，这里给大家推荐阿里的矢量库:<a href="https://www.iconfont.cn/" target="_blank" rel="noopener">链接</a></p>
<h1 id="新增UI方案"><a href="#新增UI方案" class="headerlink" title="新增UI方案"></a>新增UI方案</h1></li>
<li><p>文本新增样式</p>
</li>
<li><p>1 opacity 透明度变化</p>
</li>
<li><p>2 rgba() 添加透明的颜色</p>
</li>
<li><p>3 text-shadow 文本阴影</p>
</li>
<li><p>4 -webkit-text-stroke 文字描边</p>
</li>
<li><p>5 direction 文字排版，通常配合(unicode-bidi：bidi-override)使用<br>给大家举几个例子吧:<br>使用文本阴影实现浮雕文字</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br></pre></td><td class="code"><pre><span class="line">&lt;!DOCTYPE html&gt;</span><br><span class="line">&lt;html&gt;</span><br><span class="line">	&lt;head&gt;</span><br><span class="line">		&lt;meta charset=<span class="string">"utf-8"</span>&gt;</span><br><span class="line">		&lt;title&gt;&lt;<span class="regexp">/title&gt;</span></span><br><span class="line"><span class="regexp">		&lt;style type="text/</span>css<span class="string">"&gt;</span></span><br><span class="line"><span class="string">			*&#123;</span></span><br><span class="line"><span class="string">				margin: 0;</span></span><br><span class="line"><span class="string">				padding: 0;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			h1&#123;</span></span><br><span class="line"><span class="string">				text-align: center;</span></span><br><span class="line"><span class="string">				font: 100px/200px "</span>微软雅黑<span class="string">";</span></span><br><span class="line"><span class="string">				color: white;</span></span><br><span class="line"><span class="string">				/* 偏移量小一些，模糊程度大一些 */</span></span><br><span class="line"><span class="string">				text-shadow: black 1px 1px 10px;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">		&lt;/style&gt;</span></span><br><span class="line"><span class="string">	&lt;/head&gt;</span></span><br><span class="line"><span class="string">	&lt;body&gt;</span></span><br><span class="line"><span class="string">		&lt;h1&gt;尚硅谷&lt;/h1&gt;</span></span><br><span class="line"><span class="string">	&lt;/body&gt;</span></span><br><span class="line"><span class="string">&lt;/html&gt;</span></span><br></pre></td></tr></table></figure>
<p>模糊文字</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br></pre></td><td class="code"><pre><span class="line">&lt;!DOCTYPE html&gt;</span><br><span class="line">&lt;html&gt;</span><br><span class="line">	&lt;head&gt;</span><br><span class="line">		&lt;meta charset=<span class="string">"utf-8"</span>&gt;</span><br><span class="line">		&lt;title&gt;&lt;<span class="regexp">/title&gt;</span></span><br><span class="line"><span class="regexp">		&lt;style type="text/</span>css<span class="string">"&gt;</span></span><br><span class="line"><span class="string">			*&#123;</span></span><br><span class="line"><span class="string">				margin: 0;</span></span><br><span class="line"><span class="string">				padding: 0;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			h1&#123;</span></span><br><span class="line"><span class="string">				text-align: center;</span></span><br><span class="line"><span class="string">				font: 100px/200px "</span>微软雅黑<span class="string">";</span></span><br><span class="line"><span class="string">				color: black;</span></span><br><span class="line"><span class="string">				transition: 1s;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			h1:hover&#123;</span></span><br><span class="line"><span class="string">				color: rgba(0,0,0,0);</span></span><br><span class="line"><span class="string">				text-shadow: black 0 0 100px;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">		&lt;/style&gt;</span></span><br><span class="line"><span class="string">	&lt;/head&gt;</span></span><br><span class="line"><span class="string">	&lt;body&gt;</span></span><br><span class="line"><span class="string">		&lt;h1&gt;尚硅谷&lt;/h1&gt;</span></span><br><span class="line"><span class="string">	&lt;/body&gt;</span></span><br><span class="line"><span class="string">&lt;/html&gt;</span></span><br></pre></td></tr></table></figure>
<p>溢出显示省略号</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br></pre></td><td class="code"><pre><span class="line">&lt;!DOCTYPE html&gt;</span><br><span class="line">&lt;html&gt;</span><br><span class="line">	&lt;head&gt;</span><br><span class="line">		&lt;meta charset=<span class="string">"utf-8"</span>&gt;</span><br><span class="line">		&lt;title&gt;&lt;<span class="regexp">/title&gt;</span></span><br><span class="line"><span class="regexp">		&lt;style type="text/</span>css<span class="string">"&gt;</span></span><br><span class="line"><span class="string">			div&#123;</span></span><br><span class="line"><span class="string">				/* 盒子不能靠内容撑开，才能显示为省略号 */</span></span><br><span class="line"><span class="string">				width: 200px;</span></span><br><span class="line"><span class="string">				height: 200px;</span></span><br><span class="line"><span class="string">				border: 1px solid red;</span></span><br><span class="line"><span class="string">				margin: 0 auto;</span></span><br><span class="line"><span class="string">				/* 不换行 */</span></span><br><span class="line"><span class="string">				white-space: nowrap;</span></span><br><span class="line"><span class="string">				/* 超出隐藏 */</span></span><br><span class="line"><span class="string">				overflow: hidden;</span></span><br><span class="line"><span class="string">				/* 显示省略号 */</span></span><br><span class="line"><span class="string">				text-overflow: ellipsis;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">		&lt;/style&gt;</span></span><br><span class="line"><span class="string">	&lt;/head&gt;</span></span><br><span class="line"><span class="string">	&lt;body&gt;</span></span><br><span class="line"><span class="string">		&lt;div id="</span><span class="string">"&gt;</span></span><br><span class="line"><span class="string">			尚硅谷尚硅谷尚硅谷尚硅谷尚硅谷尚硅谷尚硅谷尚硅谷尚硅谷尚硅谷尚硅谷尚硅谷尚硅谷尚硅谷尚硅谷尚硅谷尚硅谷尚硅谷尚硅谷尚硅谷尚硅谷</span></span><br><span class="line"><span class="string">		&lt;/div&gt;</span></span><br><span class="line"><span class="string">	&lt;/body&gt;</span></span><br><span class="line"><span class="string">&lt;/html&gt;</span></span><br></pre></td></tr></table></figure>
<p>其他的例子不好举，推荐大家去MDN看看文档，这些其实就是学习API,这里给上链接:<a href="https://developer.mozilla.org/zh-CN/" target="_blank" rel="noopener">MDN</a></p>
</li>
<li><p>盒模型新增样式</p>
</li>
<li><p>1 盒子阴影 box-shadow</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br></pre></td><td class="code"><pre><span class="line">&lt;!DOCTYPE html&gt;</span><br><span class="line">&lt;html&gt;</span><br><span class="line">	&lt;head&gt;</span><br><span class="line">		&lt;meta charset=<span class="string">"utf-8"</span>&gt;</span><br><span class="line">		&lt;title&gt;&lt;<span class="regexp">/title&gt;</span></span><br><span class="line"><span class="regexp">		&lt;style type="text/</span>css<span class="string">"&gt;</span></span><br><span class="line"><span class="string">			*&#123;</span></span><br><span class="line"><span class="string">				margin: 0;</span></span><br><span class="line"><span class="string">				padding: 0;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			#test&#123;</span></span><br><span class="line"><span class="string">				/* 水平垂直居中方案1 */</span></span><br><span class="line"><span class="string">				position: absolute;</span></span><br><span class="line"><span class="string">				top: 0;</span></span><br><span class="line"><span class="string">				right: 0;</span></span><br><span class="line"><span class="string">				bottom: 0;</span></span><br><span class="line"><span class="string">				left: 0;</span></span><br><span class="line"><span class="string">				margin: auto;</span></span><br><span class="line"><span class="string">				width: 100px;</span></span><br><span class="line"><span class="string">				height: 100px;</span></span><br><span class="line"><span class="string">				background: pink;</span></span><br><span class="line"><span class="string">				text-align: center;</span></span><br><span class="line"><span class="string">				line-height: 100px;</span></span><br><span class="line"><span class="string">				/*向内扩 偏移量 模糊程度 阴影大小 颜色 */</span></span><br><span class="line"><span class="string">				/* 可以添加多个阴影，逗号分隔 */</span></span><br><span class="line"><span class="string">				/* 默认值为none 不可继承 */</span></span><br><span class="line"><span class="string">				box-shadow: inset 10px 10px 10px 0px black;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">		&lt;/style&gt;</span></span><br><span class="line"><span class="string">	&lt;/head&gt;</span></span><br><span class="line"><span class="string">	&lt;body&gt;</span></span><br><span class="line"><span class="string">		&lt;div id="</span>test<span class="string">"&gt;</span></span><br><span class="line"><span class="string">			test</span></span><br><span class="line"><span class="string">		&lt;/div&gt;</span></span><br><span class="line"><span class="string">	&lt;/body&gt;</span></span><br><span class="line"><span class="string">&lt;/html&gt;</span></span><br></pre></td></tr></table></figure></li>
<li><p>2 倒影 -webkit-box-reflect</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br></pre></td><td class="code"><pre><span class="line">&lt;!DOCTYPE html&gt;</span><br><span class="line">&lt;html&gt;</span><br><span class="line">	&lt;head&gt;</span><br><span class="line">		&lt;meta charset=<span class="string">"utf-8"</span>&gt;</span><br><span class="line">		&lt;title&gt;&lt;<span class="regexp">/title&gt;</span></span><br><span class="line"><span class="regexp">		&lt;style type="text/</span>css<span class="string">"&gt;</span></span><br><span class="line"><span class="string">			*&#123;</span></span><br><span class="line"><span class="string">				margin: 0;</span></span><br><span class="line"><span class="string">				padding: 0;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			/* 方案1，有代价，动了层 */</span></span><br><span class="line"><span class="string">		/* 	#test img&#123;</span></span><br><span class="line"><span class="string">				position: absolute;</span></span><br><span class="line"><span class="string">				top: 0;</span></span><br><span class="line"><span class="string">				right: 0;</span></span><br><span class="line"><span class="string">				bottom: 0;</span></span><br><span class="line"><span class="string">				left: 0;</span></span><br><span class="line"><span class="string">				margin: auto;</span></span><br><span class="line"><span class="string">			&#125; */</span></span><br><span class="line"><span class="string">			/* 方案2  基线居中,但是注意CSS中的很多属性会影响基线*/</span></span><br><span class="line"><span class="string">			html,body&#123;</span></span><br><span class="line"><span class="string">				height: 100%;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			#test&#123;</span></span><br><span class="line"><span class="string">				height: 100%;</span></span><br><span class="line"><span class="string">				text-align: center;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			#test::after&#123;</span></span><br><span class="line"><span class="string">				content: "</span><span class="string">";</span></span><br><span class="line"><span class="string">				display: inline-block;</span></span><br><span class="line"><span class="string">				height: 100%;</span></span><br><span class="line"><span class="string">				vertical-align: middle;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			img&#123;</span></span><br><span class="line"><span class="string">				vertical-align: middle;</span></span><br><span class="line"><span class="string">				/* 倒影  参数：位置 距离*/</span></span><br><span class="line"><span class="string">				-webkit-box-reflect: above 10px;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">		&lt;/style&gt;</span></span><br><span class="line"><span class="string">	&lt;/head&gt;</span></span><br><span class="line"><span class="string">	&lt;body&gt;</span></span><br><span class="line"><span class="string">		&lt;div id="</span>test<span class="string">"&gt;</span></span><br><span class="line"><span class="string">			&lt;img src="</span>../../../day_01/<span class="number">04</span>_新增UI方案/<span class="number">01</span>_文本新增样式/avator.jpeg<span class="string">"  width="</span><span class="number">200</span><span class="string">" height="</span><span class="number">200</span><span class="string">"&gt;</span></span><br><span class="line"><span class="string">		&lt;/div&gt;</span></span><br><span class="line"><span class="string">	&lt;/body&gt;</span></span><br><span class="line"><span class="string">&lt;/html&gt;</span></span><br></pre></td></tr></table></figure></li>
<li><p>3 resize 配合overflow使用</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br></pre></td><td class="code"><pre><span class="line">&lt;!DOCTYPE html&gt;</span><br><span class="line">&lt;html&gt;</span><br><span class="line">	&lt;head&gt;</span><br><span class="line">		&lt;meta charset=<span class="string">"utf-8"</span>&gt;</span><br><span class="line">		&lt;title&gt;&lt;<span class="regexp">/title&gt;</span></span><br><span class="line"><span class="regexp">		&lt;style type="text/</span>css<span class="string">"&gt;</span></span><br><span class="line"><span class="string">			*&#123;</span></span><br><span class="line"><span class="string">				margin: 0;</span></span><br><span class="line"><span class="string">				padding: 0;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			html,body&#123;</span></span><br><span class="line"><span class="string">				height: 100%;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			body&#123;</span></span><br><span class="line"><span class="string">				text-align: center;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			body::after&#123;</span></span><br><span class="line"><span class="string">				content: "</span><span class="string">";</span></span><br><span class="line"><span class="string">				height: 100%;</span></span><br><span class="line"><span class="string">				display: inline-block;</span></span><br><span class="line"><span class="string">				vertical-align: middle;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			div&#123;</span></span><br><span class="line"><span class="string">				display: inline-block;</span></span><br><span class="line"><span class="string">				width: 200px;</span></span><br><span class="line"><span class="string">				height: 200px;</span></span><br><span class="line"><span class="string">				background: pink;</span></span><br><span class="line"><span class="string">				vertical-align: middle;</span></span><br><span class="line"><span class="string">				/* 配合使用，描述元素是否可以拉伸 */</span></span><br><span class="line"><span class="string">				resize: both;</span></span><br><span class="line"><span class="string">				overflow: auto;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">		&lt;/style&gt;</span></span><br><span class="line"><span class="string">	&lt;/head&gt;</span></span><br><span class="line"><span class="string">	&lt;body&gt;</span></span><br><span class="line"><span class="string">		&lt;div&gt;</span></span><br><span class="line"><span class="string">			</span></span><br><span class="line"><span class="string">		&lt;/div&gt;</span></span><br><span class="line"><span class="string">	&lt;/body&gt;</span></span><br><span class="line"><span class="string">&lt;/html&gt;</span></span><br></pre></td></tr></table></figure></li>
<li><p>4 box-sizing</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br></pre></td><td class="code"><pre><span class="line">&lt;!DOCTYPE html&gt;</span><br><span class="line">&lt;html&gt;</span><br><span class="line">	&lt;head&gt;</span><br><span class="line">		&lt;meta charset=<span class="string">"utf-8"</span>&gt;</span><br><span class="line">		&lt;title&gt;&lt;<span class="regexp">/title&gt;</span></span><br><span class="line"><span class="regexp">		&lt;style type="text/</span>css<span class="string">"&gt;</span></span><br><span class="line"><span class="string">			*&#123;</span></span><br><span class="line"><span class="string">				margin: 0;</span></span><br><span class="line"><span class="string">				padding: 0;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			/* 又是一种居中方案 */</span></span><br><span class="line"><span class="string">			div&#123;</span></span><br><span class="line"><span class="string">				/* 若不指定box-sizing为border-box，此时的宽高指定的是内容的大小 */</span></span><br><span class="line"><span class="string">				/* 增加padding时，会直接在外面进行添加,导致盒子变大，居中出现问题 */</span></span><br><span class="line"><span class="string">				width: 200px;</span></span><br><span class="line"><span class="string">				height: 200px;</span></span><br><span class="line"><span class="string">				padding: 50px;</span></span><br><span class="line"><span class="string">				position: absolute;</span></span><br><span class="line"><span class="string">				left: 50%;</span></span><br><span class="line"><span class="string">				top: 50%;</span></span><br><span class="line"><span class="string">				margin-left: -100px;</span></span><br><span class="line"><span class="string">				margin-top: -100px;</span></span><br><span class="line"><span class="string">				background: pink;</span></span><br><span class="line"><span class="string">				/* 指定了这个，宽高就是盒子的宽高，pading就不会影响盒子的大小了 */</span></span><br><span class="line"><span class="string">				box-sizing: border-box;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">		&lt;/style&gt;</span></span><br><span class="line"><span class="string">	&lt;/head&gt;</span></span><br><span class="line"><span class="string">	&lt;body&gt;</span></span><br><span class="line"><span class="string">		&lt;div id="</span><span class="string">"&gt;</span></span><br><span class="line"><span class="string">			</span></span><br><span class="line"><span class="string">		&lt;/div&gt;</span></span><br><span class="line"><span class="string">	&lt;/body&gt;</span></span><br><span class="line"><span class="string">&lt;/html&gt;</span></span><br></pre></td></tr></table></figure>
<p><img src="https://img-blog.csdnimg.cn/20200424214514276.png" alt="在这里插入图片描述"><br>从里往外依次是content-box，paddding-box，border-box</p>
</li>
</ol>
<p>2.5 圆角 border-radius</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br></pre></td><td class="code"><pre><span class="line">&lt;!DOCTYPE html&gt;</span><br><span class="line">&lt;html&gt;</span><br><span class="line">	&lt;head&gt;</span><br><span class="line">		&lt;meta charset=<span class="string">"utf-8"</span>&gt;</span><br><span class="line">		&lt;title&gt;&lt;<span class="regexp">/title&gt;</span></span><br><span class="line"><span class="regexp">		&lt;style type="text/</span>css<span class="string">"&gt;</span></span><br><span class="line"><span class="string">			*&#123;</span></span><br><span class="line"><span class="string">				margin: 0;</span></span><br><span class="line"><span class="string">				padding: 0;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			#test&#123;</span></span><br><span class="line"><span class="string">				width: 200px;</span></span><br><span class="line"><span class="string">				height: 200px;</span></span><br><span class="line"><span class="string">				border: 1px solid;</span></span><br><span class="line"><span class="string">				/*我会的3种都整出来了*/</span></span><br><span class="line"><span class="string">				/*居中方案3*/</span></span><br><span class="line"><span class="string">				position: absolute;</span></span><br><span class="line"><span class="string">				left: 50%;</span></span><br><span class="line"><span class="string">				top: 50%;</span></span><br><span class="line"><span class="string">				margin-top: -100px;</span></span><br><span class="line"><span class="string">				margin-left: -100px;</span></span><br><span class="line"><span class="string">				background: pink;</span></span><br><span class="line"><span class="string">				/* 默认值0，不可继承 */</span></span><br><span class="line"><span class="string">				/* 原理:在中间画一个半径为100px的圆，再往盒子模型上的四个角上怼就完了 */</span></span><br><span class="line"><span class="string">				/* 若是多个参数，就分别以其为半径画圆怼上就完事 */</span></span><br><span class="line"><span class="string">				/* 两个参数 正斜杠(左上到右下) 反斜杠 */</span></span><br><span class="line"><span class="string">				/* 三个参数 正斜杠(左上) 反斜杠 正斜杠(右下) */</span></span><br><span class="line"><span class="string">				border-radius: 100px;</span></span><br><span class="line"><span class="string">				/*还可以画椭圆*/</span></span><br><span class="line"><span class="string">				/*表示长轴100px短轴60px的椭圆*/</span></span><br><span class="line"><span class="string">				/*border-radius: 100px/60px*/</span></span><br><span class="line"><span class="string">				/*表示正斜杠100px/60px的椭圆,反斜杠100px/40px的椭圆*/</span></span><br><span class="line"><span class="string">				/*border-radius: 100px/60px 40px*/</span></span><br><span class="line"><span class="string">				/*椭圆 圆*/</span></span><br><span class="line"><span class="string">				/*border-radius: 40px/60px 40px*/</span></span><br><span class="line"><span class="string">				/*可以使用百分比，但是旧的安卓和ios不支持百分比，需要注意*/</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">		&lt;/style&gt;</span></span><br><span class="line"><span class="string">	&lt;/head&gt;</span></span><br><span class="line"><span class="string">	&lt;body&gt;</span></span><br><span class="line"><span class="string">		&lt;div id="</span>test<span class="string">"&gt;</span></span><br><span class="line"><span class="string">			</span></span><br><span class="line"><span class="string">		&lt;/div&gt;</span></span><br><span class="line"><span class="string">	&lt;/body&gt;</span></span><br><span class="line"><span class="string">&lt;/html&gt;</span></span><br></pre></td></tr></table></figure>
<p>应用：简单的风车动画</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br></pre></td><td class="code"><pre><span class="line">&lt;!DOCTYPE html&gt;</span><br><span class="line">&lt;html&gt;</span><br><span class="line">	&lt;head&gt;</span><br><span class="line">		&lt;meta charset=<span class="string">"utf-8"</span>&gt;</span><br><span class="line">		&lt;title&gt;&lt;<span class="regexp">/title&gt;</span></span><br><span class="line"><span class="regexp">		&lt;style type="text/</span>css<span class="string">"&gt;</span></span><br><span class="line"><span class="string">			*&#123;</span></span><br><span class="line"><span class="string">				margin: 0;</span></span><br><span class="line"><span class="string">				padding: 0;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			html,body&#123;</span></span><br><span class="line"><span class="string">				/* 禁止系统滚动条 */</span></span><br><span class="line"><span class="string">				height: 100%;</span></span><br><span class="line"><span class="string">				overflow: hidden;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			#wrap&#123;</span></span><br><span class="line"><span class="string">				width: 300px;</span></span><br><span class="line"><span class="string">				height: 300px;</span></span><br><span class="line"><span class="string">				position: absolute;</span></span><br><span class="line"><span class="string">				top: 0;</span></span><br><span class="line"><span class="string">				right: 0;</span></span><br><span class="line"><span class="string">				bottom: 0;</span></span><br><span class="line"><span class="string">				left: 0;</span></span><br><span class="line"><span class="string">				margin: auto;</span></span><br><span class="line"><span class="string">				transition: 2s ease-in-out;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			#wrap &gt; div&#123;</span></span><br><span class="line"><span class="string">				width: 130px;</span></span><br><span class="line"><span class="string">				height: 130px;</span></span><br><span class="line"><span class="string">				margin: 10px;</span></span><br><span class="line"><span class="string">				border: 1px solid;</span></span><br><span class="line"><span class="string">				float: left;</span></span><br><span class="line"><span class="string">				background: deeppink;</span></span><br><span class="line"><span class="string">				box-sizing: border-box;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			#wrap &gt; div:nth-child(1),#wrap &gt; div:nth-child(4)&#123;</span></span><br><span class="line"><span class="string">				border-radius: 0 60%;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			#wrap &gt; div:nth-child(2),#wrap &gt; div:nth-child(3)&#123;</span></span><br><span class="line"><span class="string">				border-radius: 60% 0;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			#wrap:hover&#123;</span></span><br><span class="line"><span class="string">				transform: rotate(360deg);</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">		&lt;/style&gt;</span></span><br><span class="line"><span class="string">	&lt;/head&gt;</span></span><br><span class="line"><span class="string">	&lt;body&gt;</span></span><br><span class="line"><span class="string">		&lt;div id="</span>wrap<span class="string">"&gt;</span></span><br><span class="line"><span class="string">			&lt;div&gt;&lt;/div&gt;</span></span><br><span class="line"><span class="string">			&lt;div&gt;&lt;/div&gt;</span></span><br><span class="line"><span class="string">			&lt;div&gt;&lt;/div&gt;</span></span><br><span class="line"><span class="string">			&lt;div&gt;&lt;/div&gt;</span></span><br><span class="line"><span class="string">		&lt;/div&gt;</span></span><br><span class="line"><span class="string">	&lt;/body&gt;</span></span><br><span class="line"><span class="string">&lt;/html&gt;</span></span><br></pre></td></tr></table></figure>

<p>2.6 边框图片</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br></pre></td><td class="code"><pre><span class="line">&lt;!DOCTYPE html&gt;</span><br><span class="line">&lt;html&gt;</span><br><span class="line">	&lt;head&gt;</span><br><span class="line">		&lt;meta charset=<span class="string">"utf-8"</span>&gt;</span><br><span class="line">		&lt;title&gt;&lt;<span class="regexp">/title&gt;</span></span><br><span class="line"><span class="regexp">		&lt;style type="text/</span>css<span class="string">"&gt;</span></span><br><span class="line"><span class="string">			*&#123;</span></span><br><span class="line"><span class="string">				margin: 0;</span></span><br><span class="line"><span class="string">				padding: 0;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			#test&#123;</span></span><br><span class="line"><span class="string">				width: 200px;</span></span><br><span class="line"><span class="string">				height: 200px;</span></span><br><span class="line"><span class="string">				position: absolute;</span></span><br><span class="line"><span class="string">				top: 0;</span></span><br><span class="line"><span class="string">				right: 0;</span></span><br><span class="line"><span class="string">				bottom: 0;</span></span><br><span class="line"><span class="string">				left: 0;</span></span><br><span class="line"><span class="string">				margin: auto;</span></span><br><span class="line"><span class="string">				border: 50px solid;</span></span><br><span class="line"><span class="string">				/* 必须先存在borderstyle样式 */</span></span><br><span class="line"><span class="string">				/* 指定路径 */</span></span><br><span class="line"><span class="string">				border-image-source: url(../../../day_01/04_新增UI方案/01_文本新增样式/avator.jpeg);</span></span><br><span class="line"><span class="string">				/* 指定切图方案，一共四刀，可以分别指定四刀的百分比值 */</span></span><br><span class="line"><span class="string">				border-image-slice: 33.3333%;</span></span><br><span class="line"><span class="string">				/* 重复方案 */</span></span><br><span class="line"><span class="string">				border-image-repeat: round;</span></span><br><span class="line"><span class="string">				/* 图片大小，默认是边框的大小 */</span></span><br><span class="line"><span class="string">				border-image-width: 50px;</span></span><br><span class="line"><span class="string">				/* 往外放大多少 */</span></span><br><span class="line"><span class="string">				border-image-outset: 10px;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">		&lt;/style&gt;</span></span><br><span class="line"><span class="string">	&lt;/head&gt;</span></span><br><span class="line"><span class="string">	&lt;body&gt;</span></span><br><span class="line"><span class="string">		&lt;div id="</span>test<span class="string">"&gt;</span></span><br><span class="line"><span class="string">			</span></span><br><span class="line"><span class="string">		&lt;/div&gt;</span></span><br><span class="line"><span class="string">	&lt;/body&gt;</span></span><br><span class="line"><span class="string">&lt;/html&gt;</span></span><br></pre></td></tr></table></figure>
<p>关于那个切图的属性，要讲清楚得画图，我画不了，推荐大家上MDN查看吧，很详细</p>
<p>2.7 背景<br>CSS2背景</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br></pre></td><td class="code"><pre><span class="line">&lt;!DOCTYPE html&gt;</span><br><span class="line">&lt;html&gt;</span><br><span class="line">	&lt;head&gt;</span><br><span class="line">		&lt;meta charset=<span class="string">"utf-8"</span>&gt;</span><br><span class="line">		&lt;title&gt;&lt;<span class="regexp">/title&gt;</span></span><br><span class="line"><span class="regexp">		&lt;style type="text/</span>css<span class="string">"&gt;</span></span><br><span class="line"><span class="string">			*&#123;</span></span><br><span class="line"><span class="string">				margin: 0;</span></span><br><span class="line"><span class="string">				padding: 0;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			#wrap&#123;</span></span><br><span class="line"><span class="string">				position: absolute;</span></span><br><span class="line"><span class="string">				top: 0;</span></span><br><span class="line"><span class="string">				right: 0;</span></span><br><span class="line"><span class="string">				bottom: 0;</span></span><br><span class="line"><span class="string">				left: 0;</span></span><br><span class="line"><span class="string">				margin: auto;</span></span><br><span class="line"><span class="string">				width: 300px;</span></span><br><span class="line"><span class="string">				height: 300px;</span></span><br><span class="line"><span class="string">				border: 1px solid;</span></span><br><span class="line"><span class="string">				/* 背景颜色 */</span></span><br><span class="line"><span class="string">				background-color: pink;</span></span><br><span class="line"><span class="string">				/* 背景图片，会覆盖颜色，可以使用多个背景，前面的覆盖后面的 */</span></span><br><span class="line"><span class="string">				background-image: url(../../../day_01/04_新增UI方案/01_文本新增样式/avator.jpeg);</span></span><br><span class="line"><span class="string">				/* 重复方式 */</span></span><br><span class="line"><span class="string">				background-repeat: no-repeat;</span></span><br><span class="line"><span class="string">				/* 背景图的位置，使用百分比就等同于(区域大小-位图大小)*百分比px */</span></span><br><span class="line"><span class="string">				background-position: -130px -50px;</span></span><br><span class="line"><span class="string">				/* 最好别用，有问题 */</span></span><br><span class="line"><span class="string">				background-attachment: scroll;</span></span><br><span class="line"><span class="string">				/* 出现滚动条 */</span></span><br><span class="line"><span class="string">				overflow: auto;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">		&lt;/style&gt;</span></span><br><span class="line"><span class="string">	&lt;/head&gt;</span></span><br><span class="line"><span class="string">	&lt;body&gt;</span></span><br><span class="line"><span class="string">		&lt;div id="</span>wrap<span class="string">"&gt;</span></span><br><span class="line"><span class="string">			下一个 &lt;br&gt;下一个 &lt;br&gt;下一个 &lt;br&gt;下一个 &lt;br&gt;下一个 &lt;br&gt;下一个 &lt;br&gt;</span></span><br><span class="line"><span class="string">			下一个 &lt;br&gt;下一个 &lt;br&gt;下一个 &lt;br&gt;下一个 &lt;br&gt;下一个 &lt;br&gt;下一个 &lt;br&gt;下一个 &lt;br&gt;</span></span><br><span class="line"><span class="string">			下一个 &lt;br&gt;下一个 &lt;br&gt;下一个 &lt;br&gt;下一个 &lt;br&gt;下一个 &lt;br&gt;下一个 &lt;br&gt;下一个 &lt;br&gt;下一个 &lt;br&gt;下一个 &lt;br&gt;</span></span><br><span class="line"><span class="string">			下一个 &lt;br&gt;下一个 &lt;br&gt;下一个 &lt;br&gt;下一个 &lt;br&gt;下一个 &lt;br&gt;下一个 &lt;br&gt;下一个 &lt;br&gt;</span></span><br><span class="line"><span class="string">			下一个 &lt;br&gt;</span></span><br><span class="line"><span class="string">		&lt;/div&gt;</span></span><br><span class="line"><span class="string">	&lt;/body&gt;</span></span><br><span class="line"><span class="string">&lt;/html&gt;</span></span><br></pre></td></tr></table></figure>
<p>CSS3背景</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br></pre></td><td class="code"><pre><span class="line">&lt;!DOCTYPE html&gt;</span><br><span class="line">&lt;html&gt;</span><br><span class="line">	&lt;head&gt;</span><br><span class="line">		&lt;meta charset=<span class="string">"utf-8"</span>&gt;</span><br><span class="line">		&lt;title&gt;&lt;<span class="regexp">/title&gt;</span></span><br><span class="line"><span class="regexp">		&lt;style type="text/</span>css<span class="string">"&gt;</span></span><br><span class="line"><span class="string">			*&#123;</span></span><br><span class="line"><span class="string">				margin: 0;</span></span><br><span class="line"><span class="string">				padding: 0;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			#wrap&#123;</span></span><br><span class="line"><span class="string">				/* 默认情况下，背景图片是从paddingbox开始绘制 */</span></span><br><span class="line"><span class="string">				/* 从borderbox开始剪裁 */</span></span><br><span class="line"><span class="string">				position: absolute;</span></span><br><span class="line"><span class="string">				top: 0;</span></span><br><span class="line"><span class="string">				right: 0;</span></span><br><span class="line"><span class="string">				bottom: 0;</span></span><br><span class="line"><span class="string">				left: 0;</span></span><br><span class="line"><span class="string">				margin: auto;</span></span><br><span class="line"><span class="string">				width: 300px;</span></span><br><span class="line"><span class="string">				height: 300px;</span></span><br><span class="line"><span class="string">				border: 30px solid rgba(0,0,0,.3);</span></span><br><span class="line"><span class="string">                background-image: url(../../../day_01/04_新增UI方案/01_文本新增样式/avator.jpeg);</span></span><br><span class="line"><span class="string">				background-repeat: no-repeat;</span></span><br><span class="line"><span class="string">				/* 控制背景图开始渲染的位置 */</span></span><br><span class="line"><span class="string">				background-origin: padding-box;</span></span><br><span class="line"><span class="string">				/* 控制背景图开始剪裁的位置 */</span></span><br><span class="line"><span class="string">				background-clip: border-box;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">		&lt;/style&gt;</span></span><br><span class="line"><span class="string">	&lt;/head&gt;</span></span><br><span class="line"><span class="string">	&lt;body&gt;</span></span><br><span class="line"><span class="string">		&lt;div id="</span>wrap<span class="string">"&gt;</span></span><br><span class="line"><span class="string">		&lt;/div&gt;</span></span><br><span class="line"><span class="string">	&lt;/body&gt;</span></span><br><span class="line"><span class="string">&lt;/html&gt;</span></span><br></pre></td></tr></table></figure>
<p>webkit内核才有的按文字裁剪</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br></pre></td><td class="code"><pre><span class="line">&lt;!DOCTYPE html&gt;</span><br><span class="line">&lt;html&gt;</span><br><span class="line">	&lt;head&gt;</span><br><span class="line">		&lt;meta charset=<span class="string">"utf-8"</span>&gt;</span><br><span class="line">		&lt;title&gt;&lt;<span class="regexp">/title&gt;</span></span><br><span class="line"><span class="regexp">		&lt;style type="text/</span>css<span class="string">"&gt;</span></span><br><span class="line"><span class="string">			*&#123;</span></span><br><span class="line"><span class="string">				margin: 0;</span></span><br><span class="line"><span class="string">				padding: 0;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			#wrap&#123;</span></span><br><span class="line"><span class="string">				/* 默认情况下，背景图片是从paddingbox开始绘制 */</span></span><br><span class="line"><span class="string">				/* 从borderbox开始剪裁 */</span></span><br><span class="line"><span class="string">				position: absolute;</span></span><br><span class="line"><span class="string">				top: 0;</span></span><br><span class="line"><span class="string">				right: 0;</span></span><br><span class="line"><span class="string">				bottom: 0;</span></span><br><span class="line"><span class="string">				left: 0;</span></span><br><span class="line"><span class="string">				margin: auto;</span></span><br><span class="line"><span class="string">				width: 300px;</span></span><br><span class="line"><span class="string">				height: 300px;</span></span><br><span class="line"><span class="string">				border: 30px solid rgba(0,0,0,.3);</span></span><br><span class="line"><span class="string">                background-image: url(../../../day_01/04_新增UI方案/01_文本新增样式/avator.jpeg);</span></span><br><span class="line"><span class="string">				background-repeat: no-repeat;</span></span><br><span class="line"><span class="string">				/* 控制背景图开始渲染的位置 */</span></span><br><span class="line"><span class="string">				background-origin: padding-box;</span></span><br><span class="line"><span class="string">				/* 控制背景图开始剪裁的位置 */</span></span><br><span class="line"><span class="string">				/* background-clip: border-box; */</span></span><br><span class="line"><span class="string">				/* 按文字剪切背景,webkit内核才有的 */</span></span><br><span class="line"><span class="string">				-webkit-background-clip: text;</span></span><br><span class="line"><span class="string">				font: bold 80px/300px "</span>微软雅黑<span class="string">";</span></span><br><span class="line"><span class="string">				color: rgba(0,0,0,.3);</span></span><br><span class="line"><span class="string">				text-align: center;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">		&lt;/style&gt;</span></span><br><span class="line"><span class="string">	&lt;/head&gt;</span></span><br><span class="line"><span class="string">	&lt;body&gt;</span></span><br><span class="line"><span class="string">		&lt;div id="</span>wrap<span class="string">"&gt;</span></span><br><span class="line"><span class="string">			下一个</span></span><br><span class="line"><span class="string">		&lt;/div&gt;</span></span><br><span class="line"><span class="string">	&lt;/body&gt;</span></span><br><span class="line"><span class="string">&lt;/html&gt;</span></span><br></pre></td></tr></table></figure>
<p>这两个属性最好你自己试一下</p>
<p>background-size 设置图片大小</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br></pre></td><td class="code"><pre><span class="line">&lt;!DOCTYPE html&gt;</span><br><span class="line">&lt;html&gt;</span><br><span class="line">	&lt;head&gt;</span><br><span class="line">		&lt;meta charset=<span class="string">"utf-8"</span>&gt;</span><br><span class="line">		&lt;title&gt;&lt;<span class="regexp">/title&gt;</span></span><br><span class="line"><span class="regexp">		&lt;style type="text/</span>css<span class="string">"&gt;</span></span><br><span class="line"><span class="string">			*&#123;</span></span><br><span class="line"><span class="string">				margin: 0;</span></span><br><span class="line"><span class="string">				padding: 0;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			#wrap&#123;</span></span><br><span class="line"><span class="string">				/* 默认情况下，背景图片是从paddingbox开始绘制 */</span></span><br><span class="line"><span class="string">				/* 从borderbox开始剪裁 */</span></span><br><span class="line"><span class="string">				position: absolute;</span></span><br><span class="line"><span class="string">				top: 0;</span></span><br><span class="line"><span class="string">				right: 0;</span></span><br><span class="line"><span class="string">				bottom: 0;</span></span><br><span class="line"><span class="string">				left: 0;</span></span><br><span class="line"><span class="string">				margin: auto;</span></span><br><span class="line"><span class="string">				width: 300px;</span></span><br><span class="line"><span class="string">				height: 300px;</span></span><br><span class="line"><span class="string">				border: 30px solid rgba(0,0,0,.3);</span></span><br><span class="line"><span class="string">                background-image: url(../../../day_01/04_新增UI方案/01_文本新增样式/avator.jpeg);</span></span><br><span class="line"><span class="string">				background-repeat: no-repeat;</span></span><br><span class="line"><span class="string">				background-origin: padding-box;</span></span><br><span class="line"><span class="string">				/* 图片大小 */</span></span><br><span class="line"><span class="string">				/* 默认值auto 不可继承 */</span></span><br><span class="line"><span class="string">				/* 百分比：指定背景图片相对背景区的百分比，背景区由origin设置，默认为盒模型的内容区与内边距 */</span></span><br><span class="line"><span class="string">				/* 单值时，这个值指定图片的宽度，高度自适应 */</span></span><br><span class="line"><span class="string">				/* 两个值指定高度和宽度 */</span></span><br><span class="line"><span class="string">				background-size: 100% 100%;</span></span><br><span class="line"><span class="string">				</span></span><br><span class="line"><span class="string">				/* 可以简写为 background:巴拉巴拉*/</span></span><br><span class="line"><span class="string">				/* 但是不推荐这样写 太多了，出错了不好排查，最多把no-repeat加后面 */</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">		&lt;/style&gt;</span></span><br><span class="line"><span class="string">	&lt;/head&gt;</span></span><br><span class="line"><span class="string">	&lt;body&gt;</span></span><br><span class="line"><span class="string">		&lt;div id="</span>wrap<span class="string">"&gt;</span></span><br><span class="line"><span class="string">		&lt;/div&gt;</span></span><br><span class="line"><span class="string">	&lt;/body&gt;</span></span><br><span class="line"><span class="string">&lt;/html&gt;</span></span><br></pre></td></tr></table></figure>
<h1 id="渐变"><a href="#渐变" class="headerlink" title="渐变"></a>渐变</h1><p>首先我们必须明确一点，渐变是<strong>图片</strong>，是给background属性用的,它分为线性渐变和径向渐变</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br></pre></td><td class="code"><pre><span class="line">&lt;!DOCTYPE html&gt;</span><br><span class="line">&lt;html&gt;</span><br><span class="line">	&lt;head&gt;</span><br><span class="line">		&lt;meta charset=<span class="string">"utf-8"</span>&gt;</span><br><span class="line">		&lt;title&gt;&lt;<span class="regexp">/title&gt;</span></span><br><span class="line"><span class="regexp">		&lt;style type="text/</span>css<span class="string">"&gt;</span></span><br><span class="line"><span class="string">			* &#123;</span></span><br><span class="line"><span class="string">				margin: 0;</span></span><br><span class="line"><span class="string">				padding: 0;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">			#test &#123;</span></span><br><span class="line"><span class="string">				width: 200px;</span></span><br><span class="line"><span class="string">				height: 400px;</span></span><br><span class="line"><span class="string">				border: 1px solid;</span></span><br><span class="line"><span class="string">				margin: 0 auto;</span></span><br><span class="line"><span class="string">				position: absolute;</span></span><br><span class="line"><span class="string">				top: 50%;</span></span><br><span class="line"><span class="string">				left: 50%;</span></span><br><span class="line"><span class="string">				margin-top: -200px;</span></span><br><span class="line"><span class="string">				margin-left: -100px;</span></span><br><span class="line"><span class="string">				/* 渐变 默认从上到下渐变 */</span></span><br><span class="line"><span class="string">				/* to  top/right/bottom/left设置渐变的方向*/</span></span><br><span class="line"><span class="string">				/* 角度，设置渐变的方向 */</span></span><br><span class="line"><span class="string">				/* red 10% 表示从10%这个位置开始渐变 ,同样可以写像素*/</span></span><br><span class="line"><span class="string">				background-image: linear-gradient(45deg, red 10%, yellow, green);</span></span><br><span class="line"><span class="string">				/* 两个都从100px开始渐变，则没有渐变，效果就是两个颜色区块 */</span></span><br><span class="line"><span class="string">				/* background-image: linear-gradient(90deg,red 100px,yellow 100px); */</span></span><br><span class="line"><span class="string">				/* 透明度也可以渐变 rgba()*/</span></span><br><span class="line"><span class="string">				/* 重复的渐变 repeating-linear-gradient() */</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">		&lt;/style&gt;</span></span><br><span class="line"><span class="string">	&lt;/head&gt;</span></span><br><span class="line"><span class="string">	&lt;body&gt;</span></span><br><span class="line"><span class="string">		&lt;div id="</span>test<span class="string">"&gt;</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">		&lt;/div&gt;</span></span><br><span class="line"><span class="string">	&lt;/body&gt;</span></span><br><span class="line"><span class="string">&lt;/html&gt;</span></span><br></pre></td></tr></table></figure>
<p>给两个线性渐变的应用例子吧<br>发廊灯(可以使用纯CSS实现的,换成动画就行了，动画下期讲，我相信大家都会换)</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br></pre></td><td class="code"><pre><span class="line">&lt;!DOCTYPE html&gt;</span><br><span class="line">&lt;html&gt;</span><br><span class="line">	&lt;head&gt;</span><br><span class="line">		&lt;meta charset=<span class="string">"utf-8"</span>&gt;</span><br><span class="line">		&lt;title&gt;&lt;<span class="regexp">/title&gt;</span></span><br><span class="line"><span class="regexp">		&lt;style type="text/</span>css<span class="string">"&gt;</span></span><br><span class="line"><span class="string">			*&#123;</span></span><br><span class="line"><span class="string">				margin: 0;</span></span><br><span class="line"><span class="string">				padding: 0;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			#wrap&#123;</span></span><br><span class="line"><span class="string">				width: 80px;</span></span><br><span class="line"><span class="string">				height: 500px;</span></span><br><span class="line"><span class="string">				border: 1px solid;</span></span><br><span class="line"><span class="string">				position: absolute;</span></span><br><span class="line"><span class="string">				top: 0;</span></span><br><span class="line"><span class="string">				right: 0;</span></span><br><span class="line"><span class="string">				bottom: 0;</span></span><br><span class="line"><span class="string">				left: 0;</span></span><br><span class="line"><span class="string">				margin: auto;</span></span><br><span class="line"><span class="string">				overflow: hidden;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			#wrap &gt; .inner&#123;</span></span><br><span class="line"><span class="string">				width: 80px;</span></span><br><span class="line"><span class="string">				height: 1000px;</span></span><br><span class="line"><span class="string">				border: 1px solid red;</span></span><br><span class="line"><span class="string">				background-image: repeating-linear-gradient(135deg,black 0px,black 10px,white 10px ,white 20px);</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">		&lt;/style&gt;</span></span><br><span class="line"><span class="string">	&lt;/head&gt;</span></span><br><span class="line"><span class="string">	&lt;body&gt;</span></span><br><span class="line"><span class="string">		&lt;div id="</span>wrap<span class="string">"&gt;</span></span><br><span class="line"><span class="string">			&lt;div class="</span>inner<span class="string">"&gt;</span></span><br><span class="line"><span class="string">				</span></span><br><span class="line"><span class="string">			&lt;/div&gt;</span></span><br><span class="line"><span class="string">		&lt;/div&gt;</span></span><br><span class="line"><span class="string">	&lt;/body&gt;</span></span><br><span class="line"><span class="string">	&lt;script type="</span>text/javascript<span class="string">"&gt;</span></span><br><span class="line">		var light = document.querySelector("#wrap &gt; .inner");</span><br><span class="line">		<span class="keyword">var</span> flag = <span class="number">0</span>;</span><br><span class="line">		setInterval(<span class="function"><span class="keyword">function</span>(<span class="params"></span>)</span>&#123;</span><br><span class="line">			flag++;</span><br><span class="line">			<span class="keyword">if</span>(flag == <span class="number">500</span>)&#123;</span><br><span class="line">				flag = <span class="number">0</span>;</span><br><span class="line">			&#125;</span><br><span class="line">			light.style.marginTop = -flag + <span class="string">"px"</span>;</span><br><span class="line">		&#125;,<span class="number">1000</span>/<span class="number">60</span>)</span><br><span class="line">	&lt;<span class="regexp">/script&gt;</span></span><br><span class="line"><span class="regexp">&lt;/</span>html&gt;</span><br></pre></td></tr></table></figure>
<p>光斑动画</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br></pre></td><td class="code"><pre><span class="line">&lt;!DOCTYPE html&gt;</span><br><span class="line">&lt;html&gt;</span><br><span class="line">	&lt;head&gt;</span><br><span class="line">		&lt;meta charset=<span class="string">"utf-8"</span>&gt;</span><br><span class="line">		&lt;title&gt;&lt;<span class="regexp">/title&gt;</span></span><br><span class="line"><span class="regexp">		&lt;style type="text/</span>css<span class="string">"&gt;</span></span><br><span class="line"><span class="string">			html,</span></span><br><span class="line"><span class="string">			body &#123;</span></span><br><span class="line"><span class="string">				height: 100%;</span></span><br><span class="line"><span class="string">				overflow: hidden;</span></span><br><span class="line"><span class="string">				background: #000000;</span></span><br><span class="line"><span class="string">				text-align: center;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">			h1 &#123;</span></span><br><span class="line"><span class="string">				/* transition: 3s; */</span></span><br><span class="line"><span class="string">				display: inline-block;</span></span><br><span class="line"><span class="string">				margin-top: 20px;</span></span><br><span class="line"><span class="string">				font: bold 80px "</span>微软雅黑<span class="string">";</span></span><br><span class="line"><span class="string">				color: rgba(255, 255, 255, .3);</span></span><br><span class="line"><span class="string">				background-image: linear-gradient(120deg, rgba(255, 255, 255, 0) 100px, rgba(255, 255, 255, 1) 180px, rgba(255, 255, 255, 0) 260px);</span></span><br><span class="line"><span class="string">				background-repeat: no-repeat;</span></span><br><span class="line"><span class="string">				-webkit-background-clip: text;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">			/* h1:hover&#123;</span></span><br><span class="line"><span class="string">				background-position: 500px 0;</span></span><br><span class="line"><span class="string">			&#125; */</span></span><br><span class="line"><span class="string">		&lt;/style&gt;</span></span><br><span class="line"><span class="string">	&lt;/head&gt;</span></span><br><span class="line"><span class="string">	&lt;body&gt;</span></span><br><span class="line"><span class="string">		&lt;h1&gt;博客月下Ctrlc欢迎大家阅读&lt;/h1&gt;</span></span><br><span class="line"><span class="string">	&lt;/body&gt;</span></span><br><span class="line"><span class="string">	&lt;script type="</span>text/javascript<span class="string">"&gt;</span></span><br><span class="line"><span class="string">		var h1 = document.querySelector("</span>h1<span class="string">");</span></span><br><span class="line"><span class="string">		var flag = -160;</span></span><br><span class="line"><span class="string">		setInterval(function() &#123;</span></span><br><span class="line"><span class="string">			flag += 10;</span></span><br><span class="line"><span class="string">			if (flag == 500) &#123;</span></span><br><span class="line"><span class="string">				flag = -160;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			h1.style.backgroundPosition = flag + "</span>px<span class="string">";</span></span><br><span class="line"><span class="string">		&#125;, 40);</span></span><br><span class="line"><span class="string">	&lt;/script&gt;</span></span><br><span class="line"><span class="string">&lt;/html&gt;</span></span><br></pre></td></tr></table></figure>
<p>径向渐变：就是从圆心开始向外辐射<br>background-image: radial-gradient(close-corner circle at 20px 20px ,yellow 10%,red)<br>以最近的角平分渐变，圆心，圆心位置，开始的位置<br> 大家看看这儿吧,大致类似：<a href="https://developer.mozilla.org/zh-CN/docs/Web/CSS/radial-gradient" target="_blank" rel="noopener">链接</a><br>我的分享就到这里了，谢谢大家</p>

      
      <!-- reward -->
      
      <div id="reward-btn">
        打赏
      </div>
      
    </div>
    
    
      <!-- copyright -->
      
        <div class="declare">
          <ul class="post-copyright">
            <li>
              <i class="ri-copyright-line"></i>
              <strong>版权声明： </strong s>
              本博客所有文章除特别声明外，均采用 <a href="https://www.apache.org/licenses/LICENSE-2.0.html" rel="external nofollow"
                target="_blank">Apache License 2.0</a> 许可协议。转载请注明出处！
            </li>
          </ul>
        </div>
        
    <footer class="article-footer">
      
          
<div class="share-btn">
      <span class="share-sns share-outer">
        <i class="ri-share-forward-line"></i>
        分享
      </span>
      <div class="share-wrap">
        <i class="arrow"></i>
        <div class="share-icons">
          
          <a class="weibo share-sns" href="javascript:;" data-type="weibo">
            <i class="ri-weibo-fill"></i>
          </a>
          <a class="weixin share-sns wxFab" href="javascript:;" data-type="weixin">
            <i class="ri-wechat-fill"></i>
          </a>
          <a class="qq share-sns" href="javascript:;" data-type="qq">
            <i class="ri-qq-fill"></i>
          </a>
          <a class="douban share-sns" href="javascript:;" data-type="douban">
            <i class="ri-douban-line"></i>
          </a>
          <!-- <a class="qzone share-sns" href="javascript:;" data-type="qzone">
            <i class="icon icon-qzone"></i>
          </a> -->
          
          <a class="facebook share-sns" href="javascript:;" data-type="facebook">
            <i class="ri-facebook-circle-fill"></i>
          </a>
          <a class="twitter share-sns" href="javascript:;" data-type="twitter">
            <i class="ri-twitter-fill"></i>
          </a>
          <a class="google share-sns" href="javascript:;" data-type="google">
            <i class="ri-google-fill"></i>
          </a>
        </div>
      </div>
</div>

<div class="wx-share-modal">
    <a class="modal-close" href="javascript:;"><i class="ri-close-circle-line"></i></a>
    <p>扫一扫，分享到微信</p>
    <div class="wx-qrcode">
      <img src="//api.qrserver.com/v1/create-qr-code/?size=150x150&data=https://lockme.gitee.io/2020/05/14/CSS3-two-md/" alt="微信分享二维码">
    </div>
</div>

<div id="share-mask"></div>
      
      
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/CSS3/" rel="tag">CSS3</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/%E6%96%B0%E5%86%85%E5%AE%B9/" rel="tag">新内容</a></li></ul>


    </footer>

  </div>

  
  
  <nav class="article-nav">
    
      <a href="/2020/05/14/CSS3-3D-animation-md/" class="article-nav-link">
        <strong class="article-nav-caption">上一篇</strong>
        <div class="article-nav-title">
          
            CSS3-3D&amp;animation.md
          
        </div>
      </a>
    
    
      <a href="/2020/05/14/CSS3-three-md/" class="article-nav-link">
        <strong class="article-nav-caption">下一篇</strong>
        <div class="article-nav-title">CSS3_three.md</div>
      </a>
    
  </nav>


  

  
  
<!-- valine评论 -->
<div id="vcomments-box">
    <div id="vcomments">
    </div>
</div>
<script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
<script src='https://cdn.jsdelivr.net/npm/valine@1.3.10/dist/Valine.min.js'></script>
<script>
    new Valine({
        el: '#vcomments',
        app_id: 'pmaQYnbUE9O0H1hiYKLiec4R-gzGzoHsz',
        app_key: 'LMujtI79W4vgEQ3Az5IMo50y',
        path: window.location.pathname,
        notify: 'false',
        verify: 'false',
        avatar: 'mp',
        placeholder: '给我的文章加点评论吧~',
        recordIP: true
    });
    const infoEle = document.querySelector('#vcomments .info');
    if (infoEle && infoEle.childNodes && infoEle.childNodes.length > 0) {
        infoEle.childNodes.forEach(function (item) {
            item.parentNode.removeChild(item);
        });
    }
</script>
<style>
    #vcomments-box {
        padding: 5px 30px;
    }

    @media screen and (max-width: 800px) {
        #vcomments-box {
            padding: 5px 0px;
        }
    }

    #vcomments-box #vcomments {
        background-color: #fff;
    }

    .v .vlist .vcard .vh {
        padding-right: 20px;
    }

    .v .vlist .vcard {
        padding-left: 10px;
    }
</style>

  

  
  
  

</article>
</section>
      <footer class="footer">
  <div class="outer">
    <ul class="list-inline">
      <li>
        &copy;
        2020
        月下ctrlc
      </li>
      <li>
        
        Powered by
        
        
        <a href="https://hexo.io" target="_blank">Hexo</a> Theme <a href="https://github.com/Shen-Yu/hexo-theme-ayer" target="_blank">Ayer</a>
        
      </li>
    </ul>
    <ul class="list-inline">
      <li>
        
        
        <span>
  <i>PV:<span id="busuanzi_value_page_pv"></span></i>
  <i>UV:<span id="busuanzi_value_site_uv"></span></i>
</span>
        
      </li>
      
      <li>
        <!-- cnzz统计 -->
        
        <script type="text/javascript" src='https://s9.cnzz.com/z_stat.php?id=1278069914&amp;web_id=1278069914'></script>
        
      </li>
    </ul>
  </div>
</footer>
      <div class="to_top">
        <div class="totop" id="totop">
  <i class="ri-arrow-up-line"></i>
</div>
      </div>
    </main>
    <aside class="sidebar">
      <button class="navbar-toggle"></button>
<nav class="navbar">
  
  <div class="logo">
    <a href="/"><img src="/images/avatar.jpg" alt="Small Bridge"></a>
  </div>
  
  <ul class="nav nav-main">
    
    <li class="nav-item">
      <a class="nav-item-link" href="/">主页</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/archives">归档</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/categories">分类</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags">标签</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags/Vue/">Vue</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="http://shenyu-vip.lofter.com" target="_blank" rel="noopener">主题作者相册</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/2020/03/18/about">关于我</a>
    </li>
    
  </ul>
</nav>
<nav class="navbar navbar-bottom">
  <ul class="nav">
    <li class="nav-item">
      
      <a class="nav-item-link nav-item-search"  title="Search">
        <i class="ri-search-line"></i>
      </a>
      
      
      <a class="nav-item-link" target="_blank" href="/atom.xml" title="RSS Feed">
        <i class="ri-rss-line"></i>
      </a>
      
    </li>
  </ul>
</nav>
<div class="search-form-wrap">
  <div class="local-search local-search-plugin">
  <input type="search" id="local-search-input" class="local-search-input" placeholder="Search...">
  <div id="local-search-result" class="local-search-result"></div>
</div>
</div>
    </aside>
    <div id="mask"></div>

<!-- #reward -->
<div id="reward">
  <span class="close"><i class="ri-close-line"></i></span>
  <p class="reward-p"><i class="ri-cup-line"></i>拿钱砸死我吧~</p>
  <div class="reward-box">
    
    <div class="reward-item">
      <img class="reward-img" src="/images/alipay.png">
      <span class="reward-type">支付宝</span>
    </div>
    
    
    <div class="reward-item">
      <img class="reward-img" src="/images/wechat.png">
      <span class="reward-type">微信</span>
    </div>
    
  </div>
</div>
    
<script src="/js/jquery-2.0.3.min.js"></script>


<script src="/js/share.js"></script>


<script src="/js/lazyload.min.js"></script>


<script>
  try {
    var typed = new Typed("#subtitle", {
      strings: ['面朝大海，春暖花开', '愿你一生努力，一生被爱', '想要的都拥有，得不到的都释怀'],
      startDelay: 0,
      typeSpeed: 200,
      loop: true,
      backSpeed: 100,
      showCursor: true
    });
  } catch (err) {
  }

</script>




<script src="/js/tocbot.min.js"></script>

<script>
  // Tocbot_v4.7.0  http://tscanlin.github.io/tocbot/
  tocbot.init({
    tocSelector: '.tocbot',
    contentSelector: '.article-entry',
    headingSelector: 'h1, h2, h3, h4, h5, h6',
    hasInnerContainers: true,
    scrollSmooth: true,
    scrollContainer: 'main',
    positionFixedSelector: '.tocbot',
    positionFixedClass: 'is-position-fixed',
    fixedSidebarOffset: 'auto',
    onClick: (e) => {
      $('.toc-link').removeClass('is-active-link');
      $(`a[href=${e.target.hash}]`).addClass('is-active-link');
      $(e.target.hash).scrollIntoView();
      return false;
    }
  });
</script>



<script src="https://cdn.jsdelivr.net/npm/jquery-modal@0.9.2/jquery.modal.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/jquery-modal@0.9.2/jquery.modal.min.css">
<script src="https://cdn.jsdelivr.net/npm/justifiedGallery@3.7.0/dist/js/jquery.justifiedGallery.min.js"></script>

<script src="/js/ayer.js"></script>



<!-- Root element of PhotoSwipe. Must have class pswp. -->
<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true">

    <!-- Background of PhotoSwipe. 
         It's a separate element as animating opacity is faster than rgba(). -->
    <div class="pswp__bg"></div>

    <!-- Slides wrapper with overflow:hidden. -->
    <div class="pswp__scroll-wrap">

        <!-- Container that holds slides. 
            PhotoSwipe keeps only 3 of them in the DOM to save memory.
            Don't modify these 3 pswp__item elements, data is added later on. -->
        <div class="pswp__container">
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
        </div>

        <!-- Default (PhotoSwipeUI_Default) interface on top of sliding area. Can be changed. -->
        <div class="pswp__ui pswp__ui--hidden">

            <div class="pswp__top-bar">

                <!--  Controls are self-explanatory. Order can be changed. -->

                <div class="pswp__counter"></div>

                <button class="pswp__button pswp__button--close" title="Close (Esc)"></button>

                <button class="pswp__button pswp__button--share" style="display:none" title="Share"></button>

                <button class="pswp__button pswp__button--fs" title="Toggle fullscreen"></button>

                <button class="pswp__button pswp__button--zoom" title="Zoom in/out"></button>

                <!-- Preloader demo http://codepen.io/dimsemenov/pen/yyBWoR -->
                <!-- element will get class pswp__preloader--active when preloader is running -->
                <div class="pswp__preloader">
                    <div class="pswp__preloader__icn">
                        <div class="pswp__preloader__cut">
                            <div class="pswp__preloader__donut"></div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap">
                <div class="pswp__share-tooltip"></div>
            </div>

            <button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)">
            </button>

            <button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)">
            </button>

            <div class="pswp__caption">
                <div class="pswp__caption__center"></div>
            </div>

        </div>

    </div>

</div>

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/default-skin/default-skin.css">
<script src="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe-ui-default.min.js"></script>

<script>
    function viewer_init() {
        let pswpElement = document.querySelectorAll('.pswp')[0];
        let $imgArr = document.querySelectorAll(('.article-entry img:not(.reward-img)'))

        $imgArr.forEach(($em, i) => {
            $em.onclick = () => {
                // slider展开状态
                // todo: 这样不好，后面改成状态
                if (document.querySelector('.left-col.show')) return
                let items = []
                $imgArr.forEach(($em2, i2) => {
                    let img = $em2.getAttribute('data-idx', i2)
                    let src = $em2.getAttribute('data-target') || $em2.getAttribute('src')
                    let title = $em2.getAttribute('alt')
                    // 获得原图尺寸
                    const image = new Image()
                    image.src = src
                    items.push({
                        src: src,
                        w: image.width || $em2.width,
                        h: image.height || $em2.height,
                        title: title
                    })
                })
                var gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, {
                    index: parseInt(i)
                });
                gallery.init()
            }
        })
    }
    viewer_init()
</script>


<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
      tex2jax: {
          inlineMath: [ ['$','$'], ["\\(","\\)"]  ],
          processEscapes: true,
          skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
      }
  });

  MathJax.Hub.Queue(function() {
      var all = MathJax.Hub.getAllJax(), i;
      for(i=0; i < all.length; i += 1) {
          all[i].SourceElement().parentNode.className += ' has-jax';
      }
  });
</script>

<script src="https://cdn.jsdelivr.net/npm/mathjax@2.7.6/unpacked/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script>
  var ayerConfig = {
    mathjax: true
  }
</script>



<script src="/js/busuanzi-2.3.pure.min.js"></script>



<script type="text/javascript" src="https://js.users.51.la/20544303.js"></script>


    
  </div>
</body>

</html>